package com.java.io.piped;

import java.io.IOException;
import java.io.PipedInputStream;

/*
 * 接受者
 */
public class Receiver implements Runnable {

	private PipedInputStream in = null;
	
	public Receiver() {
		in = new PipedInputStream();
	}
	
	@Override
	public void run() {
		try {
			byte[] b = new byte[1000];
			int len = in.read(b);
			in.close();
			System.out.println("result --- " + (new String(b,0,len)));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public PipedInputStream getIn() {
		return in;
	}
}
